package com.qfedu.ssm.controllers;


import org.apache.shiro.authz.UnauthenticatedException;
import org.apache.shiro.authz.UnauthorizedException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler
    public String doException(Exception e){
        if (e instanceof UnauthorizedException){
            System.out.println("权限不够");
            return "lesspermission.jsp";
        }else {
            System.out.println("其他异常错误！");
            return null;
        }
    }
}
